package org.lgy.sso_comment.storage;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
 * 存储用户登录当前系统时的session，注销时清除
 */
public enum SessionStorage {
	/**
	 * 单例
	 */
	INSTANCE;
	private Map<String, HttpSession> map = new HashMap<>();
	
	public void set(String token, HttpSession session) {
		map.put(token, session);
	}
	
	public HttpSession get(String token) {
		return map.get(token);
	}

	public void remove(String token) {
		map.remove(token);
	}
}